//
//  MIDIMypaymentCell.m
//  迷笛
//
//  Created by . on 2018/11/15.
//  Copyright © 2018年 🍃🌺🌺🍃. All rights reserved.
//

#import "MIDIMypaymentCell.h"

@implementation MIDIMypaymentCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self addSubview:self.orderNumber];
        [self.orderNumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_offset(WidthScale(10));
            make.left.mas_offset(WidthScale(25));
            [self.orderNumber setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        }];
        
        [self addSubview:self.completeState];
        [self.completeState mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.orderNumber);
            make.right.mas_offset(WidthScale(-20));
            [self.completeState setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        }];
        
        
        [self addSubview:self.mainiamge];
        [self.mainiamge mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.orderNumber.mas_bottom).mas_offset(WidthScale(15));
            make.left.mas_equalTo(WidthScale(25));
            make.width.mas_equalTo(WidthScale(WidthScale(93)));
            make.height.mas_equalTo(kDevice_Is_iPhoneX?HeighX(118):HeightScale(118));
        }];
        
        [self addSubview:self.maintext];
        [self.maintext mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.mainiamge);
            make.left.equalTo(self.mainiamge.mas_right).offset(WidthScale(10));
            [self.maintext setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        }];
        
        
        
        
        [self addSubview:self.address];
        [self.address mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.maintext.mas_bottom).offset(WidthScale(10));
            make.left.equalTo(self.maintext);
            [self.address setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        }];
        [self addSubview:self.time];
        [self.time mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.address.mas_bottom).offset(WidthScale(10));
            make.left.equalTo(self.maintext);
            [self.time setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        }];
        [self addSubview:self.rmb];
        [self.rmb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.time.mas_bottom).offset(WidthScale(30));
            make.left.equalTo(self.maintext);
            [self.rmb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        }];
        [self addSubview:self.price];
        [self.price mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.time.mas_bottom).offset(WidthScale(30));
            make.left.equalTo(self.completeState);
            [self.price setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        }];
        
        [self addSubview:self.cancelBtn];
        [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.price.mas_bottom).mas_offset(WidthScale(20));
            make.right.mas_offset(WidthScale(-20));
            make.width.mas_offset(WidthScale(70));
            make.height.mas_offset(kDevice_Is_iPhoneX?HeighX(30):HeightScale(30));
        }];
    
        [self addSubview:self.topayBtn];
        [self.topayBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.cancelBtn);
            make.right.equalTo(self.cancelBtn.mas_left).mas_offset(WidthScale(-10));
            make.width.mas_offset(WidthScale(70));
            make.height.mas_offset(kDevice_Is_iPhoneX?HeighX(30):HeightScale(30));
        }];
        
        
        
    }
    return self;
}

//订单号码
-(UILabel *)orderNumber
{
    if (!_orderNumber)
    {
        _orderNumber =[[UILabel alloc]init];
        _orderNumber.font =[UIFont systemFontOfSize:WidthScale(12)];
        _orderNumber.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
    }
    return _orderNumber;
}

//海报图片
-(UIImageView *)mainiamge
{
    if (!_mainiamge)
    {
        _mainiamge =[[UIImageView alloc]init];
    }
    return _mainiamge;
}
//名称
-(UILabel *)maintext
{
    if (!_maintext)
    {
        _maintext = [[UILabel alloc]init];
        _maintext.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
        _maintext.font =[UIFont systemFontOfSize:WidthScale(16)];
        _maintext.numberOfLines = 0;
    }
    return _maintext;
}
-(UILabel *)completeState
{
    if (!_completeState)
    {
        _completeState = [[UILabel alloc]init];
        _completeState.textColor = [UIColor colorWithHexString:@"#FF005D"];
        _completeState.font =[UIFont systemFontOfSize:WidthScale(12)];
        _completeState.numberOfLines = 0;
    }
    return _completeState;
}
//地址
-(UILabel *)address
{
    if (!_address)
    {
        _address = [[UILabel alloc]init];
        _address.textColor = [UIColor colorWithHexString:@"#999999"];
        _address.font =[UIFont systemFontOfSize:WidthScale(12)];
        
    }
    return _address;
}
//时间
-(UILabel *)time
{
    if (!_time)
    {
        _time = [[UILabel alloc]init];
        _time.textColor = [UIColor colorWithHexString:@"#999999"];
        _time.font =[UIFont systemFontOfSize:WidthScale(12)];
        
    }
    return _time;
}
//票价
-(UILabel *)rmb
{
    if (!_rmb)
    {
        _rmb = [[UILabel alloc]init];
        _rmb.font =[UIFont systemFontOfSize:WidthScale(12)];
        _rmb.textColor =[UIColor colorWithHexString:@"#999999"];
    }
    return _rmb;
}
-(UILabel *)price
{
    if (!_price)
    {
        _price =[[UILabel alloc]init];
        _price.font =[UIFont systemFontOfSize:WidthScale(12)];
        _price.textColor =[UIColor colorWithHexString:@"#999999"];
    }
    return _price;
}
-(UIButton *)topayBtn
{
    if (!_topayBtn)
    {
        _topayBtn =[[UIButton alloc]init];
        [_topayBtn setTitle:@"去支付" forState:0];
        [_topayBtn setBackgroundColor:[UIColor colorWithHexString:@"#FF005D"]];
        _topayBtn.layer.masksToBounds = YES;
        [_topayBtn.layer setCornerRadius:WidthScale(5)];
    }
    return _topayBtn;
}
-(UIButton *)cancelBtn
{
    if (!_cancelBtn)
    {
        _cancelBtn =[[UIButton alloc]init];
        [_cancelBtn setTitle:@"取消订单" forState:0];
        [_cancelBtn setBackgroundColor:[UIColor colorWithHexString:@"#999999"]];
        _cancelBtn.layer.masksToBounds = YES;
        [_cancelBtn.layer setCornerRadius:WidthScale(5)];
    }
    return _cancelBtn;
}

@end
